<template>
    <div>
        <Topbar class="top">我的收藏</Topbar>

        <!--收藏列表-->
        <div class="main" ref="list"  >
                <div v-for="h in shoucanglist" >
                    <router-link :to="'/houseinfo/'+h._id">
                        <div class="housemenu">
                            <div><img :src="h.img" class="pic"></div>
                            <div class="msg">
                                <p class="text2 txt">{{h.title}}</p>
                                <p>
                                    <span class="text">{{h.address}}</span>
                                    <span class="text1">{{h.price}}</span>
                                </p>
                                <p class="text">{{h.jiedao}}</p>
                                <p  class="text1">{{h.jieshao}}</p>
                            </div>
                        </div>
                    </router-link>
                </div>
        </div>
    </div>
</template>

<script>
import Topbar from '../components/Topbar.vue'
import axios from 'axios'
    export default{
        data:function(){
            return {
                shoucanglist:[],
            }
        },
        components:{
            Topbar
        },
        mounted:function(){
            this.http.post("/house/mysc",{userid:this.userid})
            .then(res=>{
                // console.dir(res);
                res.data.data.forEach(function(e) {
                    this.shoucanglist.push(e.id)
                }.bind(this));
                // console.dir(this.shoucanglist);
            })
        },
        computed:{
            userid:function(){
                return this.$route.params.id;
            }
        }
    }
</script>

<style scoped>
.txt{
    color: black;
}
.top{
    position: fixed;
    top:0;
    width: 100%;
}
.main{
    margin-top:44px; 
    height: 100vh;
    background-color: white;
}
.housemenu{
    display: flex;
    padding: 8px 10px;
    border-bottom: 1px  solid #eeeeee;
    
}
.housemenu p{
    margin: 0;
}
.msg{
    margin-left: 10px;
}
.pic{
    width: 100px;
    height: 75px;
}
.text{
    color: #666666;
    font-size: 12px;
}
.text1{
    color: #f50;
    font-size: 12px;
}
.text2{
    font-size: 14px;
}
a{
    text-decoration: none;
}
</style>